package com.newa.actions;

import java.util.ArrayList;

import org.apache.catalina.Globals;
import org.apache.log4j.Logger;
import org.hibernate.Session;

import com.newa.beans.Orderu;
import com.newa.dao.DAOOrder;
import com.newa.utils.HibUtil;
import com.opensymphony.xwork2.ActionSupport;

public class getAllOrderus extends ActionSupport{
	private Logger LOG = Logger.getLogger(getAllOrderus.class);
	private ArrayList<Orderu> orderus;
	
	@Override
	public String execute() throws Exception {
		Session session = HibUtil.getSessionFactory().openSession();
		DAOOrder daoo = new DAOOrder(session);
		try {
			setOrderus(daoo.getAllOrders());
		} catch (Exception e) {
			LOG.warn(e);
			throw new RuntimeException(e);
		} finally{
			daoo.closeSession();
		}
		return "success";
	}
	
	public ArrayList<Orderu> getOrderus() {
		return orderus;
	}
	public void setOrderus(ArrayList<Orderu> orderus) {
		this.orderus = orderus;
	}
	
	
}
